import { createStore, applyMiddleware, compose, combineReducers } from "redux"
import thunk from 'redux-thunk'
import countReducer from './count'
import bannersReducer from './banners'
import userReducer from './user'

// 将两个reducer合并
const reducers = combineReducers({
  count: countReducer,
  banners: bannersReducer,
  user: userReducer 
})

// redux-devtools
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({trace: true}) || compose
const store = createStore(reducers, composeEnhancers(applyMiddleware(thunk)))

export default store